Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix print_fn for custom function #19419

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

sachinprasadhs
Copy link
Collaborator

@sachinprasadhs sachinprasadhs commented Apr 1, 2024

When the custom function is passed as a print_fn the existing implementation will error out since line_break will not be provided in the custom function and it has no action for custom function.

This fix will check if the print_fn is from the below logic then pass the argument line_break else call print_fn without argument line_break

    if not print_fn and not io_utils.is_interactive_logging_enabled():
        print_fn = io_utils.print_msg

https://github.com/keras-team/keras/blob/6c591d7d34c3ffaa50e805fd75c83d9c2a23414f/keras/utils/summary_utils.py#L137C1-L138C38

Fixes: #19371

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Apr 1, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 71.25%. Comparing base (6c0d75f) to head (125d723).

Files Patch % Lines
keras/utils/summary_utils.py 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19419      +/-   ##
==========================================
- Coverage   75.99%   71.25%   -4.74%     
==========================================
  Files         366      366              
  Lines       40771    40773       +2     
  Branches     7948     7949       +1     
==========================================
- Hits        30984    29054    -1930     
- Misses       8074    10062    +1988     
+ Partials     1713     1657      -56     
Flag Coverage Δ
keras 71.14% <33.33%> (-4.71%) ⬇️
keras-jax ?
keras-numpy 54.12% <0.00%> (-0.01%) ⬇️
keras-tensorflow 61.40% <33.33%> (-0.01%) ⬇️
keras-torch 60.29% <33.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fchollet fchollet merged commit d7f4605 into keras-team:master Apr 1, 2024
10 of 11 checks passed
@google-ml-butler google-ml-butler bot removed the ready to pull Ready to be merged into the codebase label Apr 1, 2024
@sachinprasadhs sachinprasadhs deleted the summary_utils branch April 1, 2024 23:13
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Apr 2, 2024
james77777778 added a commit to james77777778/keras that referenced this pull request Apr 3, 2024
* Refactor dtypes in codebase and add float8_* dtypes

* Update comments

Fix for JAX export on GPU. (keras-team#19404)

Fix formatting in export_lib. (keras-team#19405)

`ops/numpy.py`: Support `key` as `list` in `GetItem` (keras-team#19310)

When loading a model that contains `GetItem` nodes with multidimensional
indices/slices as `key`, the `key` argument is loaded from JSON as a `list`,
not a `tuple` (because JSON does not have the distinction).

So, treat the `key list` as equivalent to the `key tuple`.
Copying is important: otherwise, the later `pop()` will remove the bound
slice elements from the op itself.

`saving/serialization_lib_test.py`:

* Add `test_numpy_get_item_layer()`:
	test for consistent serialization/deserialization of a model which
	contains `ops.numpy.GetItem`;

feat(losses): add Dice loss implementation (keras-team#19409)

* feat(losses): add Dice loss implementation

* removed smooth parameter and type casting

* adjusted casting and dot operator

Update casting

Bump the github-actions group with 1 update (keras-team#19412)

Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).

Updates `github/codeql-action` from 3.24.6 to 3.24.9
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@8a470fd...1b1aada)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Fix issue with shared layer deserialization

Remove dead code in saving lib (keras-team#19415)

Remove unused beta param for silu, use torch op directly (keras-team#19417)

The beta param was only accepted on the tensorflow/torch backends
and not in the `keras.ops` API, nor was it tested. I think best
just to ditch, since no one could be relying on it.

Fix print_fn for custom function (keras-team#19419)

Add fp8 to `EinsumDense`

Add test script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
PR Queue
Assigned Reviewer
Development

Successfully merging this pull request may close these issues.

Model summary print_fn got an unexpected keyword argument 'line_break'
5 participants